home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / games / nerak2.zip / QUESTER.SCR < prev    next >
Text File  |  1995-09-24  |  5KB  |  198 lines

  1. !
  2. ! Default quester script..
  3. !
  4. ! (c) DC Software, 1989-1995
  5. !
  6.  
  7. !------------------------------------------------------------------------!
  8. :@TALK ! Talk to the character !
  9. !------------------------------------------------------------------------!
  10.  
  11.   if player.hp = 0 then
  12.     writeln( player.name, " is dead!" );
  13.     STOP;
  14.   endif;
  15.  
  16.   if npc.picture >= 0 then
  17.     viewpcx(npc);
  18.   endif;
  19.  
  20.   loadtext( npc.text ); ! Get the NPC's text block !
  21.   loadvfl( npc.voice ); ! Get the NPC's voice block !
  22. ! No more quests?
  23.   if npc.v1 = 16 GOTO NOMORE;
  24.  
  25. ! Always talk to the leader of the pack..
  26.   group.current = 0;
  27.  
  28. ! Initialize the first time through..
  29.   if npc.v0 = 0 then
  30.     npc.v0 = 1;  ! We've talked, but no quest is pending..
  31.     npc.v1 = 0;  ! Do quest 0 first.
  32.   else
  33.     if npc.v0 = 2 goto QUEST; ! We already have a quest..
  34.   endif;
  35.  
  36. ! Select the item to be quested..
  37. :LOOP
  38.   setbp( npc, npc.v1 );
  39.   if npc.bp.count = 0 then
  40.     inc( npc.v1 );       ! The slot is empty, check the next one !
  41.     if npc.v1 = 16 
  42.        goto NOMORE;      ! We've got no more quests !
  43.     goto LOOP;
  44.   endif;
  45.  
  46. :START
  47.   writeln( "Are you in need of a quest?" );
  48.  
  49.   L1 = select( "Yes", "No", "Talk", "Bye" );
  50.   ON L1 GOTO QYES, QNO, CHAT, CSTOP;
  51.  
  52. :QYES
  53.   writeln( "I'll pay you ", $npc.bp.value, " if you bring me the ", npc.bp.name );
  54.   writeln( "Good luck.." );
  55.   npc.v0 = 2; ! Quest Given
  56.   goto XSTOP;
  57.  
  58. :QNO
  59.   writeln( "Then be on your way please.." );
  60.   goto XSTOP;
  61.  
  62. !
  63. ! We HAVE a quest
  64. !
  65. :QUEST
  66.   setbp( npc, npc.v1 ); ! Select the quest that was given.. !
  67.   writeln( player.name, "! Have you brought me the ", npc.bp.name, "?" );
  68.   voice( "Quest" );
  69.  
  70.   L1 = select( "Yes", "No", "Talk", "Bye" );
  71.   on L1 goto CYES, CNO, CHAT;
  72.   goto CSTOP;
  73.  
  74. :CYES
  75.  
  76. ! Find out WHO has the item
  77.   L2 = find( player, npc.bp.name );
  78.   if L2 < 0 then 
  79.     ! No one, so find out if the object is a person..
  80.     L2 = find( group, npc.bp.name );
  81.     if L2 < 0 goto NOTHERE;
  82.   endif;
  83.  
  84.   group.current = L2;
  85. ! If the player's name matches the backpack name, its a RESCUE !
  86.   if player.name = npc.bp.name then
  87.     writeln( player.name, "! I almost didn't recognize you.." );
  88.     ! 
  89.     ! When the rescued person leaves the party, take the following actions
  90.     !
  91.     player.v1 = 2;              ! 1 when I join the party.  2 on delivery! 
  92.     if( player.text >= 0 ) then
  93.       inc( player.text );       ! Change text block (if any)
  94.     endif;
  95.     if( player.voice >= 0 ) then
  96.       inc( player.voice );      ! Change voice file (if any)
  97.     endif;
  98.     if( player.picture >= 0 ) then
  99.       inc( player.picture );    ! Change picture file (if any)
  100.     endif;
  101.     player.type = CIVILIAN;     ! No longer a prisoner !
  102.     ! Place the player at next to the NPC (quester)
  103.     leave( player.index, npc.x+1, npc.y ); ! Remove from the party
  104.     group.current = 0;
  105.   else
  106.     ! Otherwise, the quested item is in the player's backpack.
  107.     L2 = find( player.bp, npc.bp.name, npc.bp.type );
  108.     if L2 < 0 GOTO NOTHERE;
  109.     setbp( player, L2 );
  110.     vanish( player.bp );
  111.   endif;
  112.  
  113.   npc.v0 = 1;     ! No quest pending, but we already met
  114.   inc(npc.v1);    ! Increment backpack index for next quest (if any)
  115.  
  116.   ! Now give a reward..
  117.   inc( group.gold, npc.bp.value );               ! Pay for it !
  118.   writeln( $npc.bp.value, " is the reward.  Here it is." );
  119.  
  120.   if npc.bp.weight > 0 then
  121.     L4 = npc.bp.weight;                          ! Experience is given here !
  122.   else
  123.     L4 = npc.bp.value / 10 * (random(3)+1) + 1;  ! Give random experience !
  124.   endif;
  125.  
  126. ! Do the whole party..
  127.   foreach player do
  128.     inc( player.exp, L4 );    ! Level promotions are automatic !
  129.   endfor;
  130.  
  131.   if npc.bp.endgame = END_ON_GIVE then
  132.     if npc.bp.endtext > 0 then
  133.       readtext( npc.bp.endtext );
  134.     endif;
  135.     ENDGAME;
  136.   endif;
  137.  
  138. :CSTOP
  139.   writeln( "May the force be with you." );
  140.   goto XSTOP;
  141.  
  142. :CNO
  143.   writeln( "Why are you back then?" );
  144.   GOTO CHAT1;
  145.  
  146. !
  147. ! Conversation is optional for a quester, but this one likes to chat..
  148. !
  149. :CHAT
  150.   writeln( "What would you like to talk about?" );
  151.  
  152. :CHAT1
  153.   L3 = getstr("Name","Where","Quest","Bye");
  154.  
  155. ! First, see if the keyword typed is in the character's text block !
  156.   if dotext( S0 ) then
  157.     if L3 = 3 goto XSTOP;
  158.     goto CHAT1;
  159.   endif;
  160.  
  161. ! It didn't, so try the predefined ones..
  162.   on L3 goto CName, WHERE, START, CSTOP;
  163.  
  164. ! Nope, try a 'DEFAULT' line
  165.   if not dotext( "DEFAULT" ) then
  166.     writeln( "I don't know anything about that!" );
  167.   endif;
  168.   goto CHAT1;
  169.  
  170. :CName
  171.   writeln( "My name is ", npc.name, "."        );
  172.   GOTO CHAT1;
  173.  
  174. :WHERE
  175.   writeln( "If I knew where, I wouldn't need your services!" );
  176.   GOTO CHAT1;
  177.  
  178. :NOMORE
  179.   writeln( "Sorry, I have no more quests." );
  180.   goto XSTOP;
  181.  
  182. :NOTHERE
  183.   writeln( "You don't have the ", npc.bp.name, " with you." );
  184.   writeln( "Are you sure you found it?" );
  185.   L3 = select( "Yes", "No", "Maybe", "What", "Who", "Ugh..", "Bye" );
  186.   writeln( "Hmm..  Come back when you find it.." );
  187.   goto XSTOP;
  188.  
  189. !-----------------------------------------------------------------!
  190. ! All STOPs now lead here so the screen can be restored if needed !
  191. !-----------------------------------------------------------------!
  192. :XSTOP
  193.   if npc.picture >= 0 then
  194.     paint(window); ! Assumes the picture fits in the window !
  195.   endif;
  196.   stats(-1); ! Restore Stats area !
  197.   STOP;
  198.